@model ForumSettingsModel

@{
    //page title
    ViewBag.PageTitle = T("Admin.Configuration.Settings.Forums").Text;
    //active menu item (system name)
    Html.SetActiveMenuItemSystemName("Forums settings");
}

@{
    const string hideCommonBlockAttributeName = "ForumSettingsPage.HideCommonBlock";
    var hideCommonBlock = genericAttributeService.GetAttribute<bool>(workContext.CurrentCustomer, hideCommonBlockAttributeName);

    const string hidePermissionsBlockAttributeName = "ForumSettingsPage.HidePermissionsBlock";
    var hidePermissionsBlock = genericAttributeService.GetAttribute<bool>(workContext.CurrentCustomer, hidePermissionsBlockAttributeName);

    const string hidePageSizesBlockAttributeName = "ForumSettingsPage.HidePageSizesBlock";
    var hidePageSizesBlock = genericAttributeService.GetAttribute<bool>(workContext.CurrentCustomer, hidePageSizesBlockAttributeName);

    const string hideFeedsBlockAttributeName = "ForumSettingsPage.HideFeedsBlock";
    var hideFeedsBlock = genericAttributeService.GetAttribute<bool>(workContext.CurrentCustomer, hideFeedsBlockAttributeName);
}

<form asp-controller="Setting" asp-action="Forum" method="post">
    <div class="content-header clearfix">
        <h1 class="pull-left">
            @T("Admin.Configuration.Settings.Forums")
        </h1>
        <div class="pull-right">
            <button type="submit" name="save" class="btn bg-blue">
                <i class="fa fa-floppy-o"></i>
                @T("Admin.Common.Save")
            </button>
            @await Component.InvokeAsync("AdminWidget", new { widgetZone = AdminWidgetZones.ForumSettingsButtons })
        </div>
    </div>

    <div class="content">
        <div class="form-horizontal">
            @await Component.InvokeAsync("StoreScopeConfiguration")
            @await Component.InvokeAsync("SettingMode")
            <div asp-validation-summary="All"></div>

            <nop-panels id="forumsettings-panels">
                <nop-panel asp-name="forumsettings-common" asp-icon="fa fa-info" asp-title="@T("Admin.Configuration.Settings.Forums.BlockTitle.Common")" asp-hide-block-attribute-name="@hideCommonBlockAttributeName" asp-hide="@hideCommonBlock" asp-advanced="false">@await Html.PartialAsync("_Forum.Common", Model)</nop-panel>
                <nop-panel asp-name="forumsettings-permissions" asp-icon="fa fa-shield" asp-title="@T("Admin.Configuration.Settings.Forums.BlockTitle.Permissions")" asp-hide-block-attribute-name="@hidePermissionsBlockAttributeName" asp-hide="@hidePermissionsBlock" asp-advanced="false">@await Html.PartialAsync("_Forum.Permissions", Model)</nop-panel>
                <nop-panel asp-name="forumsettings-page-sizes" asp-icon="fa fa-file-o" asp-title="@T("Admin.Configuration.Settings.Forums.BlockTitle.PageSizes")" asp-hide-block-attribute-name="@hidePageSizesBlockAttributeName" asp-hide="@hidePageSizesBlock" asp-advanced="true">@await Html.PartialAsync("_Forum.PageSizes", Model)</nop-panel>
                <nop-panel asp-name="forumsettings-feeds" asp-icon="fa fa-rss" asp-title="@T("Admin.Configuration.Settings.Forums.BlockTitle.Feeds")" asp-hide-block-attribute-name="@hideFeedsBlockAttributeName" asp-hide="@hideFeedsBlock" asp-advanced="true">@await Html.PartialAsync("_Forum.Feeds", Model)</nop-panel>

                @await Component.InvokeAsync("AdminWidget", new { widgetZone = AdminWidgetZones.ForumSettingsDetailsBlock, additionalData = Model })
            </nop-panels>

            <script>
                $(document).ready(function () {
                    $("#@Html.IdFor(model => model.AllowPostVoting)").click(toggleAllowVoting);
                    $("#@Html.IdFor(model => model.AllowPrivateMessages)").click(toggleAllowPrivateMessages);
                    toggleAllowVoting();
                    toggleAllowPrivateMessages();
                });

                function toggleAllowVoting() {
                    if ($('#@Html.IdFor(model => model.AllowPostVoting)').is(':checked')) {
                        $('#pnlMaxVotes').show();
                    }
                    else {
                        $('#pnlMaxVotes').hide();
                    }
                }

                function toggleAllowPrivateMessages() {
                    if ($('#@Html.IdFor(model => model.AllowPrivateMessages)').is(':checked')) {
                        $('#pnlShowAlertForPM').show();
                        $('#pnlNotifyAboutPrivateMessages').show();
                    }
                    else {
                        $('#pnlShowAlertForPM').hide();
                        $('#pnlNotifyAboutPrivateMessages').hide();
                    }
                }
            </script>
        </div>
    </div>
</form>